//
//  CPNavigationController.m
//  CPApp
//
//  Created by 健健 on 2018/3/21.
//  Copyright © 2018年 Class. All rights reserved.
//

#import "CPNavigationController.h"

@interface CPNavigationController ()

@end

@implementation CPNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
    
    [[UITabBar appearance] setBackgroundColor:[UIColor whiteColor]];
    self.navigationBar.translucent = NO;
    self.navigationBar.barTintColor = HJColor(240, 8, 7);
    self.navigationBar.tintColor = HJColorRGB(245);
    self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: HJColorRGB(245), NSFontAttributeName:[UIFont boldSystemFontOfSize:18]};
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back_clicked"] style:UIBarButtonItemStylePlain target:self action:@selector(back:)];
    }
    [super pushViewController:viewController animated:YES];
}

- (void)back:(UIBarButtonItem *)item {
    [self popViewControllerAnimated:YES];
}

-(void)backClicked:(UIButton *)btn {
    [self popViewControllerAnimated:YES];
}

@end
